package org.example;

import java.util.Scanner;

public class Login {
    private String username = "Lessa";
    private String password = "123456";
    public void loginAuth(String username, String password) {
        if(!this.username.equals(username)) {
            //System.out.println("用户名错误！");
            throw new UsernameException("用户名输入错误");
        }
        if(!this.password.equals(password)) {
            //System.out.println("密码错误！");
            throw new PasswordException("密码输入错误");
        }
        if(this.password.equals(password) && this.username.equals(username)) {
            System.out.println("Bingou");//没有抛出异常就是登陆成功
        }
    }

    public static void main(String[] args) {
        Login login = new Login();
        Scanner in = new Scanner(System.in);
        System.out.println("请输入你的用户名：");
        String userName = in.nextLine();
        System.out.println("请输入你的密码：");
        String passWord = in.nextLine();
        login.loginAuth(userName, passWord);
    }
}
